package com.lanhai.ads.service;

import com.lanhai.ads.dao.AgvStateLogDao;
import com.lanhai.ads.dao.AgvTransferLogDao;
import com.lanhai.ads.model.AgvStateLog;
import com.lanhai.ads.model.AgvTransferLog;
import com.lanhai.ads.model.AgvTransferLogExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AgvLogService {

    @Autowired
    AgvTransferLogDao agvTransferLogDao;

    public List<AgvTransferLog> listTransferLog(AgvTransferLog bean){
        AgvTransferLogExample example = new AgvTransferLogExample();
        AgvTransferLogExample.Criteria criteria = example.createCriteria();
        if(bean.getAgvId()!=null){
            criteria.andAgvIdEqualTo(bean.getAgvId());
        }
        if(bean.getStep()!=null){
            criteria.andStepEqualTo(bean.getStep());
        }
        if(bean.getStationIp()!=null){
            criteria.andStationIpEqualTo(bean.getStationIp());
        }
        if(bean.getState()!=null){
            criteria.andStateEqualTo(bean.getState());
        }

        return agvTransferLogDao.selectByExample(example);
    }
}
